import {evalRpn,dal2Rpn} from './four_arithmetic'

export  const CALCULATION = 'CALCULATION'

export function calculation(data) {
	let res = dal2Rpn(data);
	let result = evalRpn(res.outputQueue);
	let finalResult =result.outputStack.toString();
	let errorInfo = `${res.errorInfo}${result.errorInfo}`;
	return {
		type: CALCULATION,
		result: finalResult,
		expression: data,
		error: errorInfo
	}
}

